
package py.una.pol.raphapy.autoventas.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Rafael E. Benegas
 */
@Embeddable
public class TelefonoPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "cod_per")
    private long codPer;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "num_tel")
    private String numTel;

    public TelefonoPK() {
    }

    public TelefonoPK(long codPer, String numTel) {
        this.codPer = codPer;
        this.numTel = numTel;
    }

    public long getCodPer() {
        return codPer;
    }

    public void setCodPer(long codPer) {
        this.codPer = codPer;
    }

    public String getNumTel() {
        return numTel;
    }

    public void setNumTel(String numTel) {
        this.numTel = numTel;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) codPer;
        hash += (numTel != null ? numTel.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof TelefonoPK)) {
            return false;
        }
        TelefonoPK other = (TelefonoPK) object;
        if (this.codPer != other.codPer) {
            return false;
        }
        if ((this.numTel == null && other.numTel != null) || (this.numTel != null && !this.numTel.equals(other.numTel))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.una.pol.raphapy.autoventas.model.TelefonoPK[ codPer=" + codPer + ", numTel=" + numTel + " ]";
    }
    
}
